CROSS 	= 
CC 		= @echo " GCC $@";$(CROSS)gcc
STRIP 	= @echo " STRIP $@";$(CROSS)strip
RM 		= @echo " RM -R $@";rm -rf
MV		= @echo " MV $@";mv

PWD		=$(shell pwd)/
CFLAGS  = -Wall -Os -lpthread
INC		= -I$(PWD)include/ 
BIN 	= $(PWD)/bin/
SSRC_DIR = $(PWD)info-server/
CSRC_DIR = $(PWD)info-client/
STARGECT = server
CTARGECT = cli
SSRCS    = $(wildcard $(SSRC_DIR)*.c)
SOBJS 	= $(patsubst $(SSRC_DIR)%.c,$(SSRC_DIR)%.o,$(SSRCS))
CSRCS    = $(wildcard $(CSRC_DIR)*.c)
COBJS 	= $(patsubst $(CSRC_DIR)%.c,$(CSRC_DIR)%.o,$(CSRCS))

all:$(STARGECT)
$(STARGECT): $(SOBJS)
	$(CC) $(CFLAGS) $(INC) -o $@ $^
	$(STRIP) $(STARGECT)
	$(MV) $(STARGECT) $(BIN)

$(SSRC_DIR)%.o:$(SSRC_DIR)%.c
	$(CC) $(CFLAGS) $(INC) -c $^ -o $@ 

all:$(CTARGECT)
$(CTARGECT): $(COBJS)
	$(CC) $(CFLAGS) $(INC) -o $@ $^
	$(STRIP) $(CTARGECT)
	$(MV) $(CTARGECT) $(BIN)

$(CSRC_DIR)%.o:$(CSRC_DIR)%.c
	$(CC) $(CFLAGS) $(INC) -c $^ -o $@

clean:
	$(RM) $(BIN)$(STARGECT)
	$(RM) $(SOBJS)
	$(RM) $(BIN)$(CTARGECT)
	$(RM) $(COBJS)
